package com.fourth.shopping.service.impl;

import com.fourth.entity.User;



import com.fourth.shopping.commons.TableData;
import com.fourth.shopping.dto.UserTableSearch;
import com.fourth.shopping.dao.UserMapper;
import com.fourth.shopping.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Resource
    UserMapper userMapper;



    @Override
    public List<User> selectAllUser() {
        return userMapper.selectAllUser();
    }



    @Override
    public TableData<User> getPageDate(UserTableSearch userTableSearch, Integer beginIndex, Integer pageSize) {

        List<User> users = userMapper.selectUserByPage(userTableSearch, beginIndex, pageSize);

        return  new TableData<User>(users,getUserNo(userTableSearch));
    }

    @Override
    public Integer getUserNo(UserTableSearch tableSearch) {

        return userMapper.selectNoBysearch(tableSearch);
    }

    @Override
    public Integer changeStatus(String userId,Integer status) {
        return userMapper.changeStatus(userId,status);
    }




}
